﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SchEdu.Framework.Exceptions;
using SchEdu.Framework.DataModel;
using SchEdu.Framework.Validators;

namespace SchEdu.Framework.Constraint
{
    class ReleaseDateConstraint : Constraint
    {
        public ReleaseDateConstraint()
        {
        }

        public ReleaseDateConstraint(SchEduData schEduData, SchEduDataSet.AllocationRow allocation)
            : base(schEduData, allocation)
        {
            
        }

        public override void Logic()
        {

            if (Allocation.OrderRow.ReleaseDate > Allocation.StartDate)
            {
                throw new ConstraintException(string.Format(Resources.AllocationViolateReleaseDate));
            }
        }

        public override AboutInfo AboutInfo
        {
            get
            {
                AboutInfo aboutInfo = new AboutInfo();
                aboutInfo.Title = "Release Date Constraint";
                aboutInfo.Guid = new Guid("{30144AD5-4375-4eec-A663-8ED1DA635C71}");
                aboutInfo.Description = Resources.ReleaseDateConstraintDescription;
                return aboutInfo;
            }
        }

    }
}
